from django.contrib import admin
from bbs import models

from django.apps import apps
from django.contrib.admin.sites import AlreadyRegistered
# Register your models here.


app_models = apps.get_app_config('bbs').get_models()
for model in app_models:
    try:
        admin.site.register(model)
    except AlreadyRegistered:
        pass


class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title','category','author','pub_date','last_modify','status','priority')


class CommentAdmin(admin.ModelAdmin):
    list_display = ('article','parent_comment','comment_type','comment','user','date')


class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name','set_as_top_menu','position_index')

"""

admin.site.register(models.Article)
admin.site.register(models.Category)
admin.site.register(models.Comment)
admin.site.register(models.UserProfile)

"""

